package com.bilgeadam.hibernate.program;

import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;

/**
 *  
 * @author Bora SAYINER
 * @since Nov 15, 2014 3:55:17 PM
 * @version 1.0.0
 */
public class HibernateUtil {

	private static final SessionFactory SESSION_FACTORY;

	static {
		Configuration configuration = new Configuration().configure();
		StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
		SESSION_FACTORY = configuration.buildSessionFactory(serviceRegistry);
	}

	private HibernateUtil() {

	}

	public static SessionFactory getSessionFactory() {
		return SESSION_FACTORY;
	}
}
